FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
WORKDIR /src
COPY ["Admin.Framework.Core.WebApi/Admin.Framework.Core.WebApi.csproj", "Admin.Framework.Core.WebApi/"]
COPY ["Admin.Framework.Core.Repository/Admin.Framework.Core.Repository.csproj", "Admin.Framework.Core.Repository/"]
COPY ["Admin.Framework.Core.Infrastructure/Admin.Framework.Core.Infrastructure.csproj", "Admin.Framework.Core.Infrastructure/"]
COPY ["Admin.Framework.Core.Domain/Admin.Framework.Core.Domain.csproj", "Admin.Framework.Core.Domain/"]
COPY ["Admin.Framework.Core.Application/Admin.Framework.Core.Application.csproj", "Admin.Framework.Core.Application/"]
RUN dotnet restore "Admin.Framework.Core.WebApi/Admin.Framework.Core.WebApi.csproj"
COPY . .
WORKDIR "/src/Admin.Framework.Core.WebApi"
RUN dotnet build "Admin.Framework.Core.WebApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Admin.Framework.Core.WebApi.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Admin.Framework.Core.WebApi.dll"]